package com.psjj.privilege.utils;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

public class DataSourceUtils {
    private static Properties properties = new Properties();
    private static DataSource dataSource;
    static {
        try {
            properties.load(DataSourceUtils.class.getClassLoader().getResourceAsStream("druid.properties"));
            dataSource= DruidDataSourceFactory.createDataSource(properties);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
    public static DataSource getDataSource(){
        return dataSource;
    }
}
